﻿using LVYAN.Utils;
namespace LVYAN.Service.AIAPI
{
    /// <summary>
    /// 
    /// </summary>
    public class LoginManage : BaseAPI
    {
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static void Login(string ImgPath, string LoginType, string Remark)
        {
            var Cache = new AIConfig().GetConfigModel(nameof(LoginManage), nameof(Login)).Cache;

            var Robot = new AIJQR().GetRobotModel();
            var content = JsonService.ToString(new
            {
                RobotCode = Robot.RobotCode,
                RobotName = Robot.RobotName,
                RobotAvatar = Robot.RobotAvatar,
                LoginType = LoginType,
                Remark = Remark,
                ErCode = ImgPath,
                MacAddress = WinInfo.GetMacAddress(),
                MacIP = WinInfo.GetIP(),
                MacName = WinInfo.GetHostName(),
            });
            var Result = CacheManage<string>.GetCache(content, () =>
            {
                new LoggerService().ResponseMsgDebug("发送登录", "发送消息-发送登录", content);
                var result = new RequestService().PostJson($"{AIAPI}api/aichat/login", content);
                new LoggerService().ResponseMsgDebug("发送登录", "接受消息-发送登录", result);
                return result;
            }, Cache);
        }




    }
}
